//
//  HWTakeDetailCell.m
//  JWC
//
//  Created by lanou on 16/4/18.
//  Copyright © 2016年 陈帅. All rights reserved.
//

#import "HWTakeDetailCell.h"
#import "UIImageView+WebCache.h"

@interface HWTakeDetailCell ()

@property (weak, nonatomic) IBOutlet UIImageView *bigImg;

@property (weak, nonatomic) IBOutlet UILabel *renCount;

@property (weak, nonatomic) IBOutlet UILabel *tieCount;

@property (weak, nonatomic) IBOutlet UIButton *aNewBtn;

@property (weak, nonatomic) IBOutlet UIButton *aHotBtn;

@property (weak, nonatomic) IBOutlet UIView *leftView;

@property (weak, nonatomic) IBOutlet UIView *rightView;

@end

@implementation HWTakeDetailCell

- (void)setModel:(HWTakeModel *)model
{
    self.bigImg.clipsToBounds = YES;
    [self.bigImg sd_setImageWithURL:[NSURL URLWithString:model.image_detail] placeholderImage:[UIImage imageNamed:@"20130411163304421951"]];
    self.renCount.text = [NSString stringWithFormat:@"%ld", model.post_num];
    self.renCount.textColor = [UIColor colorWithRed:248 / 255.0 green:186 / 255.0 blue:10 / 255.0 alpha:1];
    self.tieCount.text = [NSString stringWithFormat:@"%ld", model.sub_number];
    self.tieCount.textColor = [UIColor colorWithRed:248 / 255.0 green:186 / 255.0 blue:10 / 255.0 alpha:1];
}

+ (instancetype)cell
{
    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] firstObject];
}

- (IBAction)newBtn:(UIButton *)sender
{
    
    
    
    [self.aNewBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    self.leftView.backgroundColor = [UIColor redColor];
    
    [self.aHotBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.rightView.backgroundColor = [UIColor lightGrayColor];
    
    [[NSNotificationCenter defaultCenter] postNotificationName:@"newButton" object:nil userInfo:nil];
    
}

- (IBAction)hotBtn:(UIButton *)sender
{
    
    [self.aNewBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    self.leftView.backgroundColor = [UIColor lightGrayColor];
    
    [self.aHotBtn setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    self.rightView.backgroundColor = [UIColor redColor];
   
    [[NSNotificationCenter defaultCenter] postNotificationName:@"hotButton" object:nil userInfo:nil];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
